﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Play.aspx.cs" Inherits="AiXiu.WebSite.Play" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
    <title>视频播放【<%=Video.Headline %>】</title>
    <link rel="stylesheet" href="https://g.alicdn.com/de/prismplayer/2.9.16/skins/default/aliplayer-min.css" />
    <script type="text/javascript" charset="utf-8" src="https://g.alicdn.com/de/prismplayer/2.9.16/aliplayer-min.js"></script>
    <link href="Content/mui/css/mui.min.css" rel="stylesheet" />
    <link href="Content/mui/css/icons-extra.css" rel="stylesheet" />
    <style>
        #player {
            position: relative;
        }
        .mui-icon-extra{
            position: absolute;
            bottom: 120px;
            right: 16px;
            font-size: 36px;
            text-align: center;
        }
        .likeCount {
            position: absolute;
            bottom: 100px;
            right: 30px;
            text-align: center;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div class="mui-content" data-page="play">
            <div class="mui-card">
                <div class="mui-card-header mui-card-media" style="height: 110vw;" id="player">
                    <span id="like" class="mui-icon-extra mui-icon-extra-heart-filled"></span>
                    <i class="likeCount"><%=likeCount %></i>
                </div>
                <div class="mui-card-content">
                    <div class="mui-card-content-inner">
                        <p><%=Video.Headline%></p>
                        <p><i class="mui-icon mui-icon-location"></i><%=Video.Location%></p>
                    </div>
                </div>
            </div>
        </div>
    </form>
</body>
<script src="Content/jquery-3.6.0.min.js"></script>
<script src="Content/mui/js/mui.js"></script>
<script>
    $(function () {
        //获取信息是否点赞
        if (<%=isLike%>) {
            $("#like").css("color", "red");
        } else {
            $("#like").css("color", "white");
        }

        $("#like").click(function () {
            var $like = $(this);
            $.post(
                "Handler/VideoLike.ashx",
                { "videoId": "<%=VideoId%>", "userId": "<%=UserId%>" },
                function (data) {
                    if (data.StatusCode == 0) {
                        if (data.Result) {
                            $like.css("color", "red");
                            $(".likeCount").text(parseInt($(".likeCount").text()) + 1);
                            mui.toast("点赞成功");
                        } else {
                            $like.css("color", "white");
                            $(".likeCount").text(parseInt($(".likeCount").text()) - 1);
                            mui.toast("取消点赞");
                        }
                    } else {
                        mui.toast(data.Message);
                    }
                },"json"
            );
        });
    });
    var player = new Aliplayer({
        id: "player",
        source: "<%= playInfo.PlayURL%>",
        width: "100%",
        height: "500px",
        cover: '<%= playInfo.CoverURL%>',
        autoplay: false,
        preload: false,
        isLive: false
    }, function (player) {
        console.log("The player is created");
    });
</script>
</html>
